import requests
import base64


def login():
    session = requests.Session()

    url = 'https://gitee.com/oauth/token'

    data = {
        'grant_type': 'password',
        'username': '494913808@qq.com',
        'password': 'fengranhao16',
        'client_id': 'c43387a69475a559455a358d79bc18c3cbdc3a198359ea11dfda11d77ffc8c5c',
        'client_secret': '91ffe9cc9cf63d54588d24fca9201738f6263a8f1c1aa5455a6f1cfd419a0614',
        'scope': 'user_info gists projects notes',
    }

    response_get = session.post(url=url, data=data, verify=False)
    print(response_get.text)


def create_file():
    url = 'https://gitee.com/api/v5/repos/frh16/test_python/contents/verification_code.txt'

    data = {
        'access_token': 'b0cba6d3eec96aa256c0a57593d6e907',
        'content': 'NDU2',
        'message': '新建',
    }

    response_get = requests.post(url=url, data=data, verify=False)
    print(response_get.text)



if __name__ == '__main__':
    login()
    # create_file()
    # b64_b = base64.b64encode('456'.encode())
    # b64_s = b64_b.decode()
    # print(b64_s)
    # 获取仓库某个Issue所有的评论
    # 创建某个Issue评论